/* eslint-disable react/jsx-indent */
/* eslint-disable no-nested-ternary */
import React, { Component, Suspense } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import { exportQAHistories } from '@/services/download';
import qs from 'qs';
import Bottword from '@/modules/Bottword.js';
import { connect } from 'dva';
import PageLoading from '@/components/PageLoading';
import { FormattedMessage } from 'umi-plugin-react/locale';
import {
  Card,
  Row,
  Col,
  Form,
  Input,
  Button,
  message,
  Icon,
  Checkbox,
  Table,
  Tag,
  Select,
  Modal,
  Radio,
  Spin,
  Upload,
  Tabs,
  Tooltip,
} from 'antd';
import Custom from './custom.js';
import CustomNew from './customNew';
import System from './system';

const { TabPane } = Tabs;
const FormItem = Form.Item;
const Search = Input.Search;
const InputGroup = Input.Group;
import styles from './index.less';
const { Option } = Select;
const { TextArea } = Input;
const RadioGroup = Radio.Group;
import pen from '../../../assets/icons/bi.png';
import ljx from '../../../assets/icons/垃圾箱.png';
import RobotBtn from '@/utils/robotBtn';

class CustomDictionary extends Component {
  state = {
    totalAHome: 0,
    totalBHome: 0,
    size: '1',
  };

  componentDidMount() {}

  totalAHome = a => {
    console.log(a);
    this.setState({ totalAHome: a });
  };

  totalBHome = a => {
    console.log(a);
    this.setState({ totalBHome: a });
  };

  callback = key => {
    console.log(key);
  };

  Tooltipzdy = () => {
    return (
      <div>
        {`自定义实体(${this.state.totalAHome})`}
        <span style={{ marginLeft: 12, paddingTop: 3 }}>
          <Tooltip
            placement="top"
            title="1、实体列表：用户创建添加的所有个性化实体集合，实体会用在词槽创建当中，是词槽知识点必不可少的一环。2、可枚举类型实体：即能够列出实体中所有值的实体，如商品类型、产品型号等。3、不可枚举类型实体：即无法列出实体中所有值的实体，如合同号、用户UID、时间等。"
            arrowPointAtCenter
          >
            <Icon style={{ fontSize: 14 }} type="info-circle" />
          </Tooltip>
        </span>
      </div>
    );
  };

  TooltipzdyTwo = () => {
    return (
      <div>
        {`系统实体(${this.state.totalBHome})`}
        <span style={{ marginLeft: 12, paddingTop: 3 }}>
          <Tooltip placement="top" title="暂无帮助，后期增加" arrowPointAtCenter>
            <Icon style={{ fontSize: 14 }} type="info-circle" />
          </Tooltip>
        </span>
      </div>
    );
  };

  butta = () => {
    // console.log(val)
    this.setState({ size: '1' });
  };

  buttb = () => {
    // console.log(val)
    this.setState({ size: '2' });
  };

  // eslint-disable-next-line react/sort-comp
  render() {
    const { size } = this.state;
    const a = {
      color: '#fff',
      background: '-webkit-linear-gradient(left, #0E73FF , #09ACFA)',
    };
    const b = {
      color: '#fff',
      background: '-webkit-linear-gradient(right, #0E73FF , #09ACFA)',
    };
    return (
      <div style={{ margin: '0px 0px' }}>
        <p style={{marginLeft:20,marginTop:10}} className={styles.titleA}>实体管理</p>
        <div style={{marginLeft:20}} className={styles.flexcen1}>
          <div style={size === '1' ? b : null} onClick={this.butta} className={styles.butta}>
            自定义实体
            <span style={{ fontSize: 12 }}>({this.state.totalAHome})</span>
          </div>
          <div style={size === '2' ? a : null} onClick={this.buttb} className={styles.buttb}>
            系统实体
            <span style={{ fontSize: 12 }}>({this.state.totalBHome})</span>
          </div>
        </div>
        <div className={styles.backgroundp}>
          <div className="tabYs">
            {/* <CustomNew totalAHome={this.totalAHome}></CustomNew> */}
            {/* <System totalBHome={this.totalBHome}></System> */}
            {size === '1' ? <CustomNew totalAHome={this.totalAHome} /> : null}
            {size === '2' ? <System totalBHome={this.totalBHome} /> : null}
            <div style={{display:'none'}}>
            <System  totalBHome={this.totalBHome} />
            </div>
          </div>
        </div>
      </div>
    );
  }
}

export default connect(({ user }) => ({
  // 全局数据
  currentUser: user.currentUser,
}))(Form.create()(CustomDictionary));
